<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>综合实践证书查询</title>
	<meta name="viewport" content="width=device-width, initial-scale=1  maximum-scale=1 user-scalable=no">
	<meta name="mobile-web-app-capable" content="综合实践证书查询">
	<meta name="apple-mobile-web-app-capable" content="综合实践证书查询">
	<meta name="apple-touch-fullscreen" content="综合实践证书查询">
	<meta name="HandheldFriendly" content="综合实践证书查询">

	<link rel="stylesheet" href="${request.contextPath}/statics/css/materialize.css">
	<link rel="stylesheet" href="${request.contextPath}/statics/font-awesome/css/font-awesome.min.css">
	<link rel="stylesheet" href="${request.contextPath}/statics/css/normalize.css">
	<link rel="stylesheet" href="${request.contextPath}/statics/css/owl.carousel.css">
	<link rel="stylesheet" href="${request.contextPath}/statics/css/owl.theme.css">
	<link rel="stylesheet" href="${request.contextPath}/statics/css/owl.transitions.css">
	<link rel="stylesheet" href="${request.contextPath}/statics/css/fakeLoader.css">
	<link rel="stylesheet" href="${request.contextPath}/statics/css/style.css">
	<style>
		.form-field{
			color: #000000;
			font-size: 16px;
			line-height: 32px;
			display: flex;
		}
		.add {
			display: inline-block;
			width: 76px;
			height: 76px;
			color: #ccc;
			border: 2px dashed #C9CACA;
			border-radius: 10px;
			text-indent: -12em;
			transition: color .25s;
			position: relative;
			overflow: hidden;
		}
		.add:hover {
			color: #34538b;
		}
		.add::before, .add::after {
			content: '';
			position: absolute;
			top: 50%;
			left: 50%;
		}
		.add::before {
			width: 20px;
			border-top: 4px solid;
			margin: -1px 0 0 -10px;
		}
		.add::after {
			height: 20px;
			border-left: 4px solid;
			margin: -10px 0 0 -2px;
		}
		.redStar{
			color: red;
			font-size: 16px;
			line-height: 32px;
			display: flex;
			justify-content: center;
			align-items: flex-end;
		}
		input::placeholder {
			color: #C9CACA;
			font-size: 1.2rem
		}
	</style>
</head>
<body>
	<!-- contact us -->
	<div class="pages section" style="padding-top: 100px;">
		<div class="container">
			<div class="contact-us">
				<div class="row">
					<div class="col s12">
							<div class="form-group">
								<label class="form-field">学生姓名<label class="redStar">*</label> </label>
							</div>
							<div class="form-group">
								<input type="text" class="" id="userName" name="userName" placeholder="请输入姓名" required>
							</div>
							<div class="form-group">
								<label class="form-field">学生身份证号<label class="redStar">*</label> </label>
							</div>
							<div class="form-group">
								<input type="email" id="idCard" name="idCard" placeholder="请输入身份证号" required>
							</div>

							<div class="form-group" style="margin-top: 15px;padding: 0 10%;">
								<button class="btn button-default" type="button" onclick="signup()">证书查询</button>
							</div>

					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- end contact us -->
	
<!-- loader -->
	<div id="fakeLoader"></div>
	<!-- end loader -->

	
	<!-- scripts -->
	<script src="${request.contextPath}/statics/js/jquery.min.js"></script>
	<script src="${request.contextPath}/statics/js/materialize.min.js"></script>
	<script src="${request.contextPath}/statics/js/owl.carousel.min.js"></script>
	<script src="${request.contextPath}/statics/js/fakeLoader.min.js"></script>
	<script src="${request.contextPath}/statics/js/contact-form.js"></script>
	<script src="${request.contextPath}/statics/js/main.js"></script>

	<script>
		function signup(){
			var userName = $("#userName").val();
			if(!userName){
				alert("请输入学生姓名");
				return;
			}
			var idCard = $("#idCard").val();
			if(!idCard){
				alert("请输入学生身份证号");
				return;
			}
			if(!isChinaIDCard(idCard)){
				alert("请输入正确的身份证号");
				return;
			}
			var sex = $('input[name="sex"]:checked').val();
			if(!sex){
				alert("请选择学生性别");
				return;
			}

			window.location.href= "${request.contextPath}/h5/cer-detail?userName=" + userName +"&idCard=" + idCard;

			/*$.ajax({
				type: 'POST',
				url: '${request.contextPath}/h5/queryCertification',
				data: {
					userName: userName,
					idCard: idCard
				},
				success: function (res) {
					console.log(res);
					if(res.code === 0){
						console.log('success');
						window.location.href= encodeURI("${request.contextPath}/h5/cer-detail?userName=" + userName +"&idCard=" + idCard);
					}else{
						console.log('fail');
						window.location.href = "${request.contextPath}/h5/nodata";
					}
				}
			})*/
		}

		// 校验身份证号
		function isChinaIDCard(str) {
			var re = new RegExp('^[1-9]\\d{5}(19|20)\\d{2}(0[1-9]|1[0-2])([0-2][1-9]|[1-3][0-1])\\d{3}([0-9]|X)$');
			return re.test(str);
		}

		// 取性别 1男 0女
		function getChinaIDCardGender(str) {
			var genderCode = str.charAt(16);
			return genderCode % 2 === 1 ? "1" : "0";
		}



	</script>

</body>
</html>
